package org.cttic.visualization.visualization.controller;

import org.cttic.visualization.visualization.common.MarkSearchRequest;
import org.cttic.visualization.visualization.util.ResponseObject;
import org.cttic.visualization.visualization.z_service.MarkSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 2.5.3	识别点模糊查询
 */

@RestController
@CrossOrigin
public class MarkSearchController {

    @Autowired
    private MarkSearchService markSearchService;


    @RequestMapping(value = "api/idePointList/fuzzy")
    public ResponseObject idePointList(@Valid @RequestBody MarkSearchRequest request, BindingResult result){

        if (result.hasErrors()){
            return ResponseObject.error(result.getFieldError().getDefaultMessage());
        }
        return markSearchService.idePointList(request);



    }
}
